package repositories;

import java.util.Collection;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import domain.WorkUpdate;



@Repository
public interface WorkUpdateRepository extends JpaRepository<WorkUpdate, Integer>{
	@Query("select r.workUpdates from Registration r where r.id=?1")
	Collection<WorkUpdate> findByRegistrationId(int id);
	
	@Query("select w from WorkUpdate w where w.registration.project.id=?1 order by w.updateMoment")
	Collection<WorkUpdate> findByProjectId(int id);

}
